#include <stdio.h>
#include <iostream>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <arpa/inet.h>
using namespace std;

//gcc -o kankan main.cpp -lstdc++

// struct socketInfo{
// 	unsigned short int sa_family;
// };

int main(int argc,char** argv){
	cout<< "kankan ";
	for(int i=0;i<argc;i++){
		cout << argv[i]<<" ";
	}
	struct hostent *host;
	char hostname[]="baidu.com";
	struct in_addr in;
	struct sockaddr_in addr_in;
	host=gethostbyname(hostname);
	memcpy(&addr_in.sin_addr.s_addr,host->h_addr_list[0],4);
	in.s_addr=addr_in.sin_addr.s_addr;
	cout << "IP:"<<inet_ntoa(in)<<"\n";
	return 0;
}
